<%--
  Created by IntelliJ IDEA.
  User: liuqing
  Date: 2024/11/17
  Time: 17:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>register</title>
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery-3.7.1.min.js"></script>
    <style>
        .wrapper .form-wrapper.sign-up {
            transform: scale(1) translate(0, 0);
            opacity: 1;
        }
    </style>
</head>

<body>
<div class="wrapper">
    <div class="form-wrapper sign-up">
        <form action="UserRegisterServlet" method="post">
            <h2>注 册</h2>
            <div class="input-group">
                <input type="text" required id="username1" name="username1">
                <label for="username1">用户名</label>
            </div>
            <div class="input-group">
                <input type="password" required id="password1" name="password1">
                <label for="password1">密码</label>
            </div>
            <div class="input-group">
                <input type="email" required id="email" name="email">
                <label for="email">邮箱</label>
            </div>
            <div class="remember">
                <label for="rem"><input type="radio" id="rem" onclick="toggleLoginButton()" required>我同意协议</label>
            </div>
            <button type="submit" id="registerButton" disabled style="background: #ceebff;">注 册</button>
            <div class="signUp-link">
                <p>已经有账号了<a href="login.jsp" class="signInBtn-link">登录</a></p>
            </div>
        </form>
    </div>
</div>

<script>
    function toggleLoginButton() {
        var rem = document.getElementById('rem');
        var registerButton = document.getElementById('registerButton');
        if (rem.checked) { // 检查复选框是否被勾选
            registerButton.disabled = false; // 启用按钮
            registerButton.style.backgroundColor = "#0099ff"; // 设置按钮背景颜色
        } else {
            registerButton.disabled = true; // 禁用按钮
            registerButton.style.backgroundColor = ""; // 重置按钮背景颜色
        }
    }
</script>
<%
    String msg =(String) request.getAttribute("msg");
    if (msg!=null){
        request.removeAttribute("msg");
%>
<script type="text/javascript">
    window.onload = function() {
        alert("<%=msg%>");

    };
</script>
<%
    }
%>
</body>
</html>
